<%@page import="RssEasy.Core.CookieHelper"%>
<%@page import="RssEasy.Core.Encrypt"%>
<%@page import="Model.User.UserList"%>
<%
    CookieHelper cookies = new CookieHelper(request, response);
    UserList user = new UserList(pageContext);
    user.request();
    String enterprise = user.get("enterprise").toLowerCase();
    String account = user.get("account").toLowerCase();
    String pwd = user.get("pwd").toLowerCase();
    String Encryption = account + pwd;
    String test = user.get("test");
    if (test.equals("email")) {
        if (user.select().where("email=?", user.get("email")).get_first_rows()) {
            out.print(1);
        }
    }
    if (test.equals("test")) {
        if (user.select().where("account=?", account).get_first_rows()) {
            out.print(1);
        }
    }
    if (test.equals("forget")) {
        if (user.select().where("telphone=?", user.get("telphone")).get_first_rows()) {
            out.print("1");
        }
    }
    if (test.equals("login")) {
        if (user.get("learn").length() > 0) {
            if (user.select().where("enterprise=? and account=? and pwd=?", enterprise, account, Encrypt.Md532(Encryption)).get_first_rows()) {
                cookies.Set("level", user.get("parentmyid"), 7);
                cookies.Set("myid", user.get("myid"), 7);
                cookies.Set("account", user.get("account"), 7);
                cookies.Set("learn", "ok", 7);
                out.print(1);
            }
        } else {
            if (user.select().where("account=? and pwd=?", account, Encrypt.Md532(Encryption)).get_first_rows()) {
                cookies.Set("level", user.get("parentmyid"), 0);
                cookies.Set("myid", user.get("myid"), 0);
                cookies.Set("account", user.get("account"), 0);
                out.print(1);
            }
        }
    }
    if (test.equals("account")) {
        if (user.select().where("account=?", user.get("account")).get_first_rows()) {
            out.print(1);
        }
    }
%>






